load("@rules_rust//rust:defs.bzl", "rust_library")
load("//bazel:canisters.bzl", "rust_canister")
load("//bazel:defs.bzl", "rust_ic_test")

package(default_visibility = ["//visibility:public"])

rust_library(
    name = "stable_memory_integrity",
    srcs = glob(["src/**/*.rs"]),
    aliases = {},
    crate_name = "ic_stable_memory_integrity",
    proc_macro_deps = [],
    version = "0.9.0",
    deps = [
        # Keep sorted.
        "@crate_index//:candid",
        "@crate_index//:ic-cdk",
        "@crate_index//:serde",
    ],
)

rust_canister(
    name = "stable_memory_integrity_canister",
    srcs = ["bin/main.rs"],
    service_file = ":stable_memory_integrity.did",
    deps = [
        # Keep sorted.
        "//rs/rust_canisters/stable_memory_integrity",
        "@crate_index//:candid",
        "@crate_index//:ic-cdk",
    ],
)

rust_ic_test(
    name = "tests",
    timeout = "long",
    srcs = ["tests/stable_memory_integrity.rs"],
    aliases = {},
    crate_root = "tests/stable_memory_integrity.rs",
    data = [
        ":stable_memory_integrity_canister.wasm.gz",
    ],
    env = {
        "STABLE_MEMORY_INTEGRITY_CANISTER_WASM_PATH": "$(rootpath :stable_memory_integrity_canister.wasm.gz)",
    },
    proc_macro_deps = [],
    deps = [
        # Keep sorted.
        "//rs/rust_canisters/canister_test",
        "//rs/rust_canisters/stable_memory_integrity",
        "//rs/state_machine_tests",
        "//rs/types/base_types",
        "//rs/types/types",
        "@crate_index//:assert_matches",
        "@crate_index//:candid",
        "@crate_index//:lazy_static",
        "@crate_index//:proptest",
    ],
)
